﻿using System;
using System.Collections;
using FlowCanvas;
using FlowCanvas.Nodes;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
using Yoozoo.Gta.Common;

namespace Yoozoo.Gameplay.Liberty.Nodes
{
    [Category("Ggame")]
    public class OpenSelectCarUI : LatentActionNodeBase
    {
        public override bool allowRoutineQueueing { get { return false; } }
        
     
        protected override void OnRegisterDerivedPorts(FlowNode node)
        {
            node.AddFlowInput("In", (f) =>
            {
                StopCoroutine();
                Begin(Invoke(), f);
            });
        }

        public IEnumerator Invoke()
        {
            bool opened = false;
            Action callBack = () =>
            {
                opened = true;
            };
            ResidentHandler.Inst.GetFunction("CityLuaFunction.openSelectCarUI").Action(0,callBack);    
            yield return new UnityEngine.WaitUntil(() => opened);

        }
        
        

    }
}